<template>
  <div>
    <h1>home</h1>
    <router-link to="/home/homea">homeA</router-link>
    <router-link to="/home/homeb">homeB</router-link>
    <router-view></router-view>
    <p>{{$route.params.id}}</p>
  </div>
</template>

<script>
export default {
  // keep-alive包裹着router-view组件的显示隐藏，不是销毁重建，created只执行一次
  created() {
    console.log("created");
  },
  // keep-alive缓存组件激活时调用
  activated() {
    console.log("activated");
  },
  // keep-alive缓存组件失活时调用
  deactivated() {
    console.log("deactivated");
  }
};
</script>

<style></style>
